<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <meta name="format-detection" content="telephone=no">
  <meta http-equiv="x-rim-auto-match" content="none">
  <title>云闪付付款</title>
  <script src="${request.contextPath}/statics/js/jquery.js"></script>
  <script src="${request.contextPath}/statics/js/qrcode.min.js"></script>
  <style>
    * {
      padding: 0;
      margin: 0;
    }
    a {
      text-decoration: none;
    }
    a{
      color: #000000;}
    a:link{color:#000000}
    a:hover{
      color: #000000;}
    .clearfix1:after {
      content: '';
      height: 0;
      line-height: 0;
      visibility: hidden;
      display: block;
      clear: both;
    }

    .clearfix1 {
      zoom: 1;
    }

    html, body {
      background-color: #EDEDED;
    }

    .page {
      width: 660px;
      margin: 0 auto 24px;
      background-color: #ffffff;
    }

    .header {
      position: relative;
      text-align: center;
      height: 67px;
      line-height: 67px;
      vertical-align: middle;
      overflow: hidden;
      padding: 10px 0;
    }
 .header .img {
   width: 10%;
   display: inline-block;
 }
    .header img {
      width: 100%;
      vertical-align: middle;
    }

    .main {
      overflow: hidden;
    }

    .main .money {
      margin: 36px auto;
      height: 21px;
      line-height: 21px;
      color: #ff0000;
      font-size: 30px;
      font-family: HelveticaNeue;
      text-align: center;
    }

    .main .qr {
      position: relative;
      width: 250px;
      height: 250px;
      margin: 0 auto;
      background: url("/statics/unionpay/images/box.png") no-repeat;
      background-size: 100% 100%;
      border: 1px solid transparent;
    }
.main .qr .ok {
  display: none;
  position: absolute;
  top: 26px;
  left: 26px;
  width: 200px;
  height: 200px;
  background: url("/statics/unionpay/images/ok.png") no-repeat;
  background-size:100% 100%;

}
    .main .qr #showqr {
      width: 200px;
      height: 200px;
      margin: 26px auto;
      /*background: url("/statics/unionpay/images/qr.png") no-repeat;*/
      background-size: 100% 100%;
    }

    .main .qr .time {
      width: 176px;
      height: 28px;
      font-size: 22px;
      font-family: PingFangSC-Regular;
      position: absolute;
      top: -12px;
      left: 50%;
      transform: translateX(-50%);
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .main .qr .txt {
      color: #999999;
      font-size: 14px;
      width: 150px;
      position: absolute;
      bottom: -6px;
      left: 50%;
      transform: translateX(-50%);
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
    }

    .green {
      color: #FF0000;
    }
.save {
  display: none;
}

    .main .order {
      margin: 21px auto 14px;
      text-align: center;
      font-size: 18px;
      color: #999999;
      font-family: PingFangSC-Medium;
    }

    .main .txt1 {
      letter-spacing: 1px;
      width: 60%;
      padding: 2% 0;
      text-align: center;
      margin: 0 auto 20px;
      color: #ffffff;
      font-size: 22px;
      /*font-weight: bold;*/
      font-family: PingFangSC-Regular;
      background: #D44535;
      border-radius: 5px;
    }

    .main .footer {
      width: 80%;
      margin: 27px auto 0;
      border-top: 2px solid #dbdbdb;
      padding-top: 12px;
      font-size: 20px;
      color: #000;
    }
    .main .footer div {
      padding-left: 20px;
    }
    .main .footer .tip {
      float: left;
      display: inline-block;
      width: 20px;
      height: 20px;
      background: url("/statics/unionpay/images/tip.png") no-repeat;
      background-size: 100% 100%;
    }

    .tip_txt {
      float: left;
      font-size: 20px;
      margin-left: 8px;
      color: #ff0000;
      display: inline-block;
      height: 18px;
      line-height: 18px;
    }

    .main .footer p {
      margin-bottom: 6px;
      padding-left: 20px;
      padding-bottom: 12px;
      border-bottom: 1px dotted #f1f1f1;
    }
    .mob {
      display: none;
    }
    @media (max-width: 640px) {
      @keyframes changeColor {
        0%{color: #d82b1e}
        50% {color: #e79739;}
        100%{color: #d82b1e}
      }
      .jiaocheng {
        animation: changeColor 1s infinite;
      }

      .page {
        width: 100%;
        margin: auto;
        background-color: #EDEDED;
      }
      .header {
        height: 50px;
        line-height: 50px;
        margin-top: 15px;
        /* margin-bottom: 20px; */
        padding: 0;
      }
      .header .img {
        width: 13%;
      }
      .header .jiaocheng {
        position: absolute;
        display: inline-block;
        top: 0;
        right: 5%;
      }
      .main .money {
        margin: 15px auto 35px;
      }
      .main .qr .time {
        font-size: 20px;
      }
      .main .order {
        font-size: 15px;
      }
      .main .order .save {
        display: flex;
        justify-content: center;
        align-items: center;
        font-weight: 400;
        font-size: 14px;
        color: #000000;
        margin-bottom: 10px;
      }
      .save a {
        display: flex;
        align-items: center;
        justify-content: center;
      }
      .main .order .save img {
        width: 12%;
      }
      .pc {
        display: none;
      }
      .mob {
        display: block;
      }
      .main .txt1 {
        width: 85%;
        padding: 3% 0;
        font-size: 16px;
        margin: 0 auto 10px;
        font-weight: bold;
        background-color: #D44535;
      }
      .main .txt2 {
       /* color: #59BA36;
        background-color: #ffffff;*/
        font-weight: bold;
      }
      .main .footer {
        margin: 15px auto 0;
        font-size: 15px;
        width: 95%;
      }
      .main .footer div {
        padding-left: 15px;
      }
      .main .footer p {
        margin-bottom: 3px;
        padding-left: 15px;
        padding-bottom: 5px;
      }
      .main .footer .tip {
        width: 18px;
        height: 18px;
      }
      .tip_txt {
        font-size: 18px;
      }
    }
  </style>
</head>
<body>
<div class="header page">
  <span class="img">
      <img src="/statics/unionpay/images/logo.png" alt="">
  </span>
  <!--<a class="mob jiaocheng" href="javascript:void (0)">扫码教程</a>-->
</div>
<div class="main page">
  <div class="money">
    <span>&yen;</span> <span id="money">${amount !''}</span>
  </div>
  <div class="qr clearfix1">
    <div class="ok"></div>
    <div id="showqr">
    </div>
    <div class="time">
      <div class="minute green">9</div>&nbsp;分&nbsp;<div class="second green">59</div>&nbsp;秒
    </div>
    <div class="txt">
     	 客官请稍等片刻
    </div>
  </div>
  <div class="order">
    <span class="save">
      <a href="http://youhui.95516.com/hybrid_v3/html/help/download.html?source=1" target="_blank">
        <img src="/statics/unionpay/images/apple.png" alt="">&nbsp;苹果云闪付下载
      </a>
      <a href="http://youhui.95516.com/hybrid_v3/html/help/download.html?source=1" target="_blank">
        <img src="/statics/unionpay/images/andriod.png" alt="">&nbsp;安卓云闪付下载
      </a>
    </span>
  	  订单号：<span id="order">${orderid !''}</span>
  </div>
  <div class="txt1 mob">
    <span class="mob">长按二维码或截屏保存至相册</span>
  </div>
  <div class="txt1 txt2">使用云闪付或手机银行扫一扫 </div>

  <div class="footer">
    <div style="margin-bottom: 18px;overflow: hidden;"><span class="tip"></span><span class="tip_txt">温馨提示</span>
    </div>
    <p>1、如付款失败，请重新生成二维码</p>
    <p>2、如充值未到账，请联系在线客服</p>
  </div>
</div>

<style>
  .tanchu {
    background-color: transparent !important;
    box-shadow: none !important;
  }
  .tanchu .layui-layer-content {
    overflow: hidden !important;
  }
  .close {
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 40px;
    display: inline-block;
  }
</style>

<div id="tanchu" style="display: none;">
  <!-- <img src="/statics/unionpay/images/jiaocheng.png" alt="" style="width: 100%;"> -->
  <!--<span onclick="layer.closeAll();" class="close"></span>-->
</div>

<script src="https://cdn.bootcss.com/layer/2.3/layer.js"></script>
<!-- <script>
  $('.jiaocheng').on('click',function () {
    layer.open({
      title: '',
      area: '85%',
      offset: '30px',
      type: 1,
      closeBtn:1,
      shadeClose: false,
      scrollbar: false,
      resize:false,
      anim: -1,
      fixed: true,
      skin: 'tanchu',
      content: $('#tanchu')
    })
  })
</script> -->

</body>
<script>
  var qrcode = new QRCode(document.getElementById("showqr"), {
    text: "${payurl !''}",
    width: 200,
    height: 200,
    colorDark : "#000000",
    colorLight : "#ffffff",
    correctLevel : QRCode.CorrectLevel.H
  });
</script>
<script>
  /*字体变换*/
  var text = document.querySelector('.txt');
  var txt_arr = ['确认过眼神你是我的菜','这个二维码很特别特别','充值未到账请联系客服','充值未成功请重新生成'];
  var num = 0;
  var timer_txt = setInterval(function () {
    text.innerText = txt_arr[num];
    num++;
    if (num === 4) {
      num = 0;
    }
  },1500)

  /*倒计时*/
  var minute = document.querySelector(".minute")
  var second = document.querySelector(".second")
  // 准备
  var countdownMinute = 10 //10分钟倒计时
  var startTimes = new Date() //开始时间
  var endTimes = new Date(startTimes.setMinutes(startTimes.getMinutes() + countdownMinute)) //结束时间
  var curTimes = new Date() //当前时间
  var surplusTimes = endTimes.getTime() / 1000 - curTimes.getTime() / 1000 //结束毫秒-开始毫秒=剩余倒计时间

  // 进入倒计时
  countdowns = window.setInterval( () => {
    surplusTimes--;
    var minu = Math.floor(surplusTimes / 60)
    var secd = Math.round(surplusTimes % 60)
    // console.log(minu+':'+secd)
    minu = minu <= 9 ? '0' + minu : minu
    secd = secd <= 9 ? '0' + secd : secd
    minute.innerHTML = minu
    second.innerHTML = secd
    // checkdata();
    if (surplusTimes <= 0) {
      alert('订单已过期,请勿支付,请重新发起订单！');
      window.history.go(-1);
      location.reload();
      clearInterval(countdowns)
    }
  },1000)
// $('.ok').show();
  
  var orderid = "${orderid !''}";
  setInterval(checkdata,3000);
  function checkdata(){
    $.ajax({
      type: 'GET',
      url: '${request.contextPath}/api/checkOrderStatus/'+orderid,
      dataType: 'json',
      success: function (str) {
        if (str.data == "ok") {
          $("#showqr img").attr("src","${request.contextPath}/statics/image/pay_ok.png");
          $("#money").text("支付成功");
          setTimeout(function(){
             closeWebPage();
          }, 5000);
        }
      }
    });
  }
  
  function closeWebPage(){
	  var userAgent = navigator.userAgent;
	  if (userAgent.indexOf("Firefox") != -1 || userAgent.indexOf("Chrome") !=-1) {
	      window.location.href="about:blank";   
	  }else if(userAgent.indexOf('Android') > -1 || userAgent.indexOf('Linux') > -1){
	      window.opener=null;window.open('about:blank','_self','').close(); 
	  }else {
	      window.pener = null;
	      window.open("about:blank", "_self");
	      window.close();
	  }
  }
</script>
</html>